home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 001-010 / amok08 / iff8svxload / playkanon.mod < prev    next >
Text File  |  1993-11-04  |  2KB  |  74 lines

  1. (*---------------------------------------------------------------------------
  2.     :Program.    PlayKanon.mod
  3.     :Author.     Fridtjof Siebert
  4.     :Address.    Nobileweg 67, D-7-Stgt-40
  5.     :Shortcut.   [fbs]
  6.     :Version.    1.0
  7.     :Date.       19-Sep-88
  8.     :Copyright.  PD
  9.     :Language.   Modula-II
  10.     :Translator. M2Amiga
  11.     :Imports.    IFF8SVXLoad [fbs], MemSystem [bne]
  12.     :UpDate.     none.
  13.     :Contents.   Program to play a sampled Sound on 4 times with 0.5s delay.
  14.     :Remark.     Usage: PlayKanon <iff-soundfile>
  15. ---------------------------------------------------------------------------*)
  16.  
  17. MODULE PlayKanon;
  18.  
  19. FROM SYSTEM      IMPORT ADR, ADDRESS, SHIFT, BITSET, LONGSET, CAST;
  20.  
  21. FROM Arts        IMPORT Terminate;
  22.  
  23. FROM Arguments   IMPORT NumArgs, GetArg;
  24.  
  25. FROM Dos         IMPORT Delay;
  26.  
  27. FROM IFF8SVXLoad IMPORT Read8SVX, Dealloc8SVX, IFF8SVXInfoPtr, PlaySample,
  28.                         OpenAudio, CloseAudio, WaitPlay, AllChannels;
  29.  
  30. CONST
  31.   ProgName = "PlaySample, © 1988 by Fridtjof Siebert [Amok]";
  32.  
  33. VAR
  34.   Name: ARRAY[0..79] OF CHAR; (* the Sound's Name                          *)
  35.   length: INTEGER;            (* dummy for receiving Name's Length         *)
  36.   Info: IFF8SVXInfoPtr;       (* Sound's Data                              *)
  37.   i: CARDINAL;
  38.  
  39. BEGIN
  40.  
  41. (*------  Get Name:  ------*)
  42.  
  43.   IF NumArgs()#0 THEN
  44.     GetArg(1,Name,length);
  45.   ELSE
  46.     Terminate(0);
  47.   END;
  48.  
  49. (*------  Read and Play Sound:  ------*)
  50.  
  51.   Info := Read8SVX(Name,20000,FALSE);        (* load sound  *)
  52.  
  53.   IF Info#NIL THEN
  54.  
  55.     IF OpenAudio(4,0) THEN                  (* open audio  *)
  56.  
  57.       FOR i:=0 TO 3 DO
  58.         IF PlaySample(Info,0,1,i) THEN      (* play sound  *)
  59.           Delay(25);
  60.         END;
  61.       END;
  62.       WaitPlay(AllChannels);
  63.  
  64.       Delay(100);      (* wait 2s to get last samples before closing audio *)
  65.       CloseAudio();                         (* close audio *)
  66.  
  67.     END;
  68.  
  69.     Dealloc8SVX(Info);                      (* free sound  *)
  70.  
  71.   END;
  72.  
  73. END PlayKanon.
  74.